<?php
declare (strict_types = 1);

namespace app;

use think\Service;
use think\facade\Config;

/**
 * 应用服务类
 */
class AppService extends Service
{
    public function register()
    {
        // 服务注册
    }

    public function boot()
    {
        // 服务启动
        $this->loadExtraConfig();
    }

    protected function loadExtraConfig()
    {
        $extraPath = $this->app->getRootPath() . 'app/extra/';

        $files = glob($extraPath . '*' . '.php');
        foreach($files as $file) {
            Config::load($file, pathinfo($file, PATHINFO_FILENAME));
        }
    }
}
